package action.commande;


import org.junit.After;
import org.junit.Before;

import servletunit.struts.MockStrutsTestCase;

public class TestEditionInfoPersoAction extends MockStrutsTestCase {

	@Before
	public void setUp() throws Exception {
		super.setUp();
	}

	@After
	public void tearDown() throws Exception {
	}
	
	public void testValidationInfoClient(){
		setRequestPathInfo("/EditionInfoPersoAction");
		addRequestParameter("validationInfoClient", "validationInfoClient");
		addRequestParameter("modificationInfoClient", "M");
		addRequestParameter("civilite", "M");
		addRequestParameter("nomClient", "Bouli");
		addRequestParameter("prenomClient", "Jack");
		addRequestParameter("jour_client", "1");
		addRequestParameter("mois", "01");
		addRequestParameter("annee", "2001");
		addRequestParameter("telephone_portable", "0640123615");
		addRequestParameter("telephone_fixe", "0140123615");
		addRequestParameter("rue_client", "7 rue de la Pisse");
		addRequestParameter("rue_client_suite", "");
		addRequestParameter("ville_client", "Lognes");
		addRequestParameter("code_postal_client", "77185");
		addRequestParameter("pays_client", "Pays");
		getRequest().getSession().setAttribute("typeCompte", 1);
		actionPerform();
		verifyForward("success");
	}

	public void testModificationInfoClient(){
		setRequestPathInfo("/EditionInfoPersoAction");
		addRequestParameter("validationInfoClient", "");
		addRequestParameter("modificationInfoClient", "modificationInfoClient");
		addRequestParameter("civilite", "M");
		addRequestParameter("nomClient", "Bouli");
		addRequestParameter("prenomClient", "Jack");
		addRequestParameter("jour_client", "1");
		addRequestParameter("mois", "01");
		addRequestParameter("annee", "2001");
		addRequestParameter("telephone_portable", "0640123615");
		addRequestParameter("telephone_fixe", "0140123615");
		addRequestParameter("rue_client", "7 rue de la Pisse");
		addRequestParameter("rue_client_suite", "");
		addRequestParameter("ville_client", "Lognes");
		addRequestParameter("code_postal_client", "77185");
		addRequestParameter("pays_client", "Pays");
		getRequest().getSession().setAttribute("typeCompte", 1);
		getRequest().getSession().setAttribute("id_compte", "1");
		actionPerform();
		verifyForward("successEditionInfo");
	}
	
	public void testAutreInfoClient(){
		setRequestPathInfo("/EditionInfoPersoAction");
		addRequestParameter("validationInfoClient", "");
		addRequestParameter("modificationInfoClient", "");
		addRequestParameter("civilite", "M");
		addRequestParameter("nomClient", "Bouli");
		addRequestParameter("prenomClient", "Jack");
		addRequestParameter("jour_client", "1");
		addRequestParameter("mois", "01");
		addRequestParameter("annee", "2001");
		addRequestParameter("telephone_portable", "0640123615");
		addRequestParameter("telephone_fixe", "0140123615");
		addRequestParameter("rue_client", "7 rue de la Pisse");
		addRequestParameter("rue_client_suite", "");
		addRequestParameter("ville_client", "Lognes");
		addRequestParameter("code_postal_client", "77185");
		addRequestParameter("pays_client", "Pays");
		getRequest().getSession().setAttribute("typeCompte", 1);
		getRequest().getSession().setAttribute("id_compte", "1");
		actionPerform();
		verifyForward("successEditionInfo");
	}
}
